SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE Procedure [dbo].[TvShow_Insert_Episodes]
@TvId INT, @TVDBId INT, @SeasonNumber INT, @EpisodeNumber INT, @Name varchar(250), 
@Rating FLOAT, @Overview varchar(MAX), @AirDate DATETIME
AS
INSERT INTO TvShow_Episodes
	(TvId, TVDBId, SeasonId, EpisodeId, Title, Rating, [Description], AirDate, CreatedDate)
	
Select @TvId, @TVDBId, SeasonId, @EpisodeNumber, @Name, 
		@Rating, @Overview, @AirDate, GetDate()
from tvshow_seasons
Where TvId = @TvId And Season = @SeasonNumber
GO
